#pragma once
#include "Model.h"

#include <string>
#include <Network/TcpClient.h>
#include <Game/ClientPacketProducer.h>
#include <Game/ClientPacketHandler.h>

enum GameState
{
	eCONNECTING			,	// Wait for server respond.
	eWAITINGFORMATCHING	,	// Wait for server's matching information
	eGAMEPLAYING		,
	eDISCONNECTED			// Need to be restart application
};

class MyModel : public Model, public ClientPacketHandler
{
public:
	MyModel(void);
	virtual ~MyModel(void);

	// Override 
	void DoLogic();
	void OnMouseMove	( float fX , float fY );
	void OnLButtonDown	( float fX , float fY );

	// Test
	float mLastMouseX;
	float mLastMouseY;

	inline GameState GetState() const { return this->mState; }
	void SetState( GameState inState );

// Oliver commented
//protected:
//	void packetParser();
//	void OnPacket();

protected: // ClientPacketHandler
	virtual void OnStarted();
	virtual void OnStopped();
	virtual void OnLogin(bool result);

private:
	GameState mState;

	TcpIoLoop mIoLoop;
	TcpClient mClient;
	ClientPacketProducer mPacketProducer;
};

